package com.star.service.impl;

import com.star.entry.User;
import com.star.mapper.UserMapper;
import com.star.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Random;
import java.util.UUID;

@SuppressWarnings("all")
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    public boolean insert(User user) {
        Random random=new Random();
        Integer i = random.nextInt(9999);
        String s = i.toString();
        user.setUsername(s);
        return userMapper.insert(user)==1?true:false;
    }

    public boolean update(User user) {
        return userMapper.update(user)==1?true:false;
    }

    public User select(User user) {
        return userMapper.select(user);
    }

    public User selectForgot(User user) {
        return userMapper.selectForgot(user);
    }
}
